import { defineStore } from 'pinia'

export const usegwc = defineStore('gwc', {
  state: () => {
    return { 
        gwclist:[]
    }
  },
  actions: {
    gwc_list(i) {
        const num=this.gwclist.find(code=>code.goods_id==i.goods_id)
        if(!num){
            this.gwclist.push(i)
        }
        else
        {
            num.number+=1
        }
        // this.gwclist.push(i)
    },
    jia_list(i){
        i.number+=1
    },
    jian_list(i){
        i.number-=1
    },
    jian_list1(i,index){
        this.gwclist.splice(1,index)
    }
  },
})